from flask import Flask, abort, request, render_template

app=Flask(__name__)

@app.route("/register",methods=["GET","POST"])

def register():
    if request.method == "GET":
        return  render_template("register.html")
    if request.method == "POST":
        username = request.form.get("username")
        password = request.form.get("password")
        password2 = request.form.get("password2")
        print(username)
        print(password)
        print(password2)
        if("赵四"==username):
            abort(405)
            return None
        else:
            return "注册成功"
@app.errorhandler(405)
def handle_405_error(err):
    return render_template("405.html")
if __name__ == '__main__':
    app.run()